<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>GShark</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="stylesheet" href="/lib/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/lib/font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="/lib/adminLET2/css/AdminLTE.min.css">
    <link rel="stylesheet" href="/lib/adminLET2/css/skins/skin-blue.css">
    <link rel="stylesheet" href="/css/main.css">
    <link rel="stylesheet" href="/lib/code_prettify/prettify.css">
    <script src="/lib/code_prettify/prettify.js"></script>
</head>
<body class="hold-transition skin-blue sidebar-collapse" onload="prettyPrint()">
<div class="wrapper">
{{template "header"}}
{{template "menu" . }}
    <div class="content-wrapper">
        <section class="content-header">
            <h1>
                源代码扫描报告
            </h1>
            <ol class="breadcrumb">
                <li><a href="/admin/reports/github/" class="btn btn-success c-add-btn"> 主页</a></li>
                <li class="btn btn-success c-add-btn">检测结果</li>
            </ol>
        </section>
        <section class="content">
            <div class="row c-manager">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-body">
                            <div class="filter">
                                <div class="row">
                                    <div class="col-xs-10">
                                        <div class="col-xs-2">
                                            <label>状态：</label>
                                        </div>
                                        <div class="form-group col-xs-6">
                                            <div class="status">
                                                <input name="status" type="radio" id="unhandled" value="unhandled"
                                                       {{if eq 0 .status}}checked{{end}}></input>
                                                <label>未处理</label>
                                                <input name="status" type="radio" id="confirmed" value="confirmed"
                                                       {{if eq 1 .status}}checked{{end}}></input>
                                                <label>已确认</label>
                                                <input name="status" type="radio" id="ignored" value="ignored"
                                                       {{if eq 2 .status}}checked{{end}}></input>
                                                <label>已忽略</label>
                                            </div>
                                        </div>
                                        <div class="col-xs-2">
                                            <a href="/admin/reports/github/cancelall"><img src="/img/fail.png" alt="忽略所有" style="width: 24px;height: 24px;"></a>
                                        </div>
                                    </div>

                                </div>
                            </div>
                            <table class="table table-striped table-bordered table-hover">
                                <thead>
                                <tr align="center">
                                    <th>ID</th>
                                    <th>Repo Name</th>
                                    <th>Matches</th>
                                    <th>Keyword</th>
                                    {{if eq 0 .status}}
                                        <th colspan="3">Review</th>
                                    {{else}}
                                        <th>Status</th>
                                    {{end}}
                                </tr>
                                {{range .reports}}
                                <tr>
                                    <td><a href="/admin/reports/github/report_detail/{{.Id}}" target="_blank">{{.Id}}</a> </td>
                                    <td><a href="{{.HTMLURL}}" target="_blank">{{.RepoName}} > {{.Name}}</a></td>
                                    <td class="code-column">
                                    <code class="prettyprint linenums">{{range  .TextMatches}}
                                    {{range Split .Fragment }}
                                    {{.}}<br>
                                    {{end}}
                                    {{end}}
                                    </code>
                                    </td>
                                    <td>{{ .Keyword}}</td>
                                    {{if eq 0 .Status}}
                                    <td><a href="/admin/reports/github/confirm/{{.Id}}"><img src="/img/confirm.png" alt="确认" title="确认该仓库为泄露信息"/></a></td>
                                    <td><a href="/admin/reports/github/cancel/{{.Id}}"><img src="/img/file.png" alt="忽略文件" title="忽略文件"/></a></td>
                                    <td><a href="/admin/reports/github/disable_repo/{{.Id }}"><img src="/img/repo.png" alt="忽略仓库" title="忽略仓库"/></a></td>
                                    {{else}}
                                            <td>
                                                {{if eq 1 .Status}}Confirmed<a href="/admin/reports/github/cancel/{{.Id}}"><img src="/img/file.png" alt="忽略文件" title="忽略文件"/></a>
                                                {{else}}Ignored<a href="/admin/reports/github/confirm/{{.Id}}"><img src="/img/confirm.png" alt="确认" title="确认该仓库为泄露信息"/></a>{{end}}
                                            </td>
                                    {{end}}
                                </tr>
                                {{end}}
                                </thead>
                            </table>
                            {{template "page" . }}
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>
</div>
<script src="/lib/jQuery/jquery-2.2.3.min.js"></script>
<script src="/lib/bootstrap/js/bootstrap.min.js"></script>
<script src="/lib/datatables/jquery.dataTables.min.js"></script>
<script src="/lib/datatables/dataTables.bootstrap.min.js"></script>
<script src="/lib/adminLET2/js/app.min.js"></script>
<script src="/js/common.js"></script>
<script>
    document.onkeydown = function () {
        if (event.keyCode === 37) {
            document.querySelector('.page-arear .pagination li:nth-child(2) a').click();
        } else if (event.keyCode === 39) {
            document.querySelector('.page-arear .pagination li:nth-last-child(2) a').click();
        }
    }
</script>
</body>
</html>
